$(function () {
    loading();
    var msgId = getQueryString("msgId");
    ajaxShowMsg(msgId);
    flushUser();
});

function ajaxShowMsg(msgId) {
    var url = "/Lvscore_User_M/msg/ajaxShowMsg";
    $.post(url, {
        msgId: msgId
    }, function (data) {
        $("#msg_prefix").html("【" + data.msg_prefix + "】");
        $("#msg_title").html(data.msg_title);
        $("#msg_content").html(data.msg_content);
        var id = $("#userId").val();
        $("#execute").one('click', function () {
            ajaxaddFriendExecute(id, msgId);
        });
        $("#unExecute").one('click', function () {
            ajaxaddFriendUnExecute(id, msgId);
        });
        $("#person").click(function () {
            window.location.href = "/Lvscore_User_M/userWeb/views/accounterCenter/addFriend.html"
            var cookie = new sweetCookie();
            cookie.setCookie("searchF", id);
        });
        $(".loadingBox").hide();
    }, "json")
}
function ajaxaddFriendExecute(friendId, msgId) {
    var url = "/Lvscore_User_M/account/ajaxaddFriendExecute";
    $.post(url, {
        friendId: friendId,
        msgId: msgId
    }, function (data) {
        window.location.reload();
    });
}
function ajaxaddFriendUnExecute(friendId, msgId) {
    var url = "/Lvscore_User_M/account/ajaxaddFriendUnExecute";
    $.post(url, {
        friendId: friendId,
        msgId: msgId
    }, function (data) {
        window.location.reload();
    });
}